The % operator returns the remainder after dividing two numbers. See more details here.
def modulo1(num, mod):
result = num % mod
return result
Function Call | Return Value | |||
---|---|---|---|---|
modulo1(9, 2) | → | |||
modulo1(13, 2) | → | |||
modulo1(10, 5) | → | |||
modulo1(30, 4) | → | |||
modulo1(8, 1) | → |
Experiment with this code on Gitpod.io